// es5继承
// Person父类存放姓名/年龄
function Person (name, age) {
  this.name = name
  this.age = age
}

Person.prototype.sayHi = function () {
  console.log(`Hi~, my name is ${this.name}, I'm ${this.age} this year`);
}

// Student子类存放成绩
function Student (name, age, score) {
  // 盗用继承（用父类构造函数初始化子类实例）
  Person.call(this, name, age)
  this.score = score

  // 子类方法
  this.study = function () {
    console.log(`it's to strenuous!`)
  }
}

Student.prototype = new Person()
Student.prototype.constructor = Student

let s1 = new Student('niko', 23, 80)
s1.study()
s1.sayHi()
